﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using LTSMZ.life.DAL;
using LTSMZ.life.Model;
using System.Data.SqlClient;

namespace LTSMZ.life.BLL
{
    public class ProductBll
    {
        ProductDal dal = new ProductDal();
        /// <summary>
        /// 商品信息添加
        /// </summary>
        /// <param name="p"></param>
        /// <returns></returns>
        public int ProductAdd(Product p)
        {
            return dal.AddProduct(p);
        }
        /// <summary>
        /// 商品信息删除
        /// </summary>
        /// <returns></returns>
        public int DeleteProductId(int id)
        {
            return dal.DeleteProductById(id);
        }
        /// <summary>
        /// 商品信息(根据编号查找该信息）
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public SqlDataReader ShowProductBypid(int id)
        {
            return dal.ShowProductBypid(id);
        }
        /// <summary>
        /// 商品信息修改（修改）
        /// </summary>
        /// <param name="w"></param>
        /// <returns></returns>
        public int AlterProduct(Product p)
        {
            return dal.AlterProduct(p);
        }
        ///// <summary>
        ///// 商品信息显示
        ///// </summary>
        ///// <returns></returns>
        //public SqlDataReader show()
        //{
        //    return dal.show();
        //}
        /// <summary>
        /// 下拉框显示
        /// </summary>
        /// <returns></returns>
        public List<SecondType> ShowSecondType()
        {
            return dal.ShowSecondType();

        }
        /// <summary>
        /// 商品信息显示
        /// </summary>
        /// <returns></returns>
        public List<Product> show()
        {
            return dal.show();
        }
        /// <summary>
        /// 商品上下架
        /// </summary>
        /// <param name="Pid"></param>
        /// <returns></returns>
        public int AlterProduct1(int Pid)
        {
            return dal.AlterProduct1(Pid);
        }
        /// <summary>
        /// 首页新鲜水果展示
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public List<Product> Show1()
        {
            return dal.Show1();
        }
        /// <summary>
        /// 首页新鲜蔬菜展示
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public List<Product> ShowShucai()
        {
            return dal.ShowShucai();
        }
        /// <summary>
        /// 首页水产海鲜展示
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public List<Product> Showshuichan()
        {
            return dal.Showshuichan();
        }
        /// <summary>
        /// 根据一级类别查询商品
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public List<Product> GetFirsTypeNameProduct(string name)
        {
            return dal.GetFirsTypeNameProduct(name);
        }
        /// <summary>
        /// 爆款推荐
        /// </summary>
        /// <returns></returns>
        public List<Product> ShowBaoKuan()
        {
            return dal.ShowBaoKuan();
        }
        /// <summary>
        /// 显示肉禽食品
        /// </summary>
        /// <returns></returns>
        public List<Product> ShowRou()
        {
            return dal.ShowRou();
        }
        /// <summary>
        /// 显示水产海鲜
        /// </summary>
        /// <returns></returns>
        public List<Product> ShowShui()
        {
            return dal.ShowShui();
        }
        /// <summary>
        /// 显示厨房用品
        /// </summary>
        /// <returns></returns>
        public List<Product> ShowChu()
        {
            return dal.ShowChu();
        }
        /// <summary>
        /// 显示小型家电
        /// </summary>
        /// <returns></returns>
        public List<Product> ShowJia()
        {
            return dal.ShowJia();
        }
        /// <summary>
        /// 根据编号获取商品信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public Product GetProductId(int id)
        {
            return dal.GetProductId(id);
        }
        /// <summary>
        /// 显示4肉禽食品
        /// </summary>
        /// <returns></returns>
        public List<Product> ShowRou2()
        {
            return dal.ShowRou2();
        }
        /// <summary>
        /// 显示4水产海鲜
        /// </summary>
        /// <returns></returns>
        public List<Product> ShowShui2()
        {
            return dal.ShowShui2();
        }
        /// <summary>
        /// 显示4爆款推荐
        /// </summary>
        /// <returns></returns>
        public List<Product> ShowbaokuanT()
        {
            return dal.ShowbaokuanT();
        }
        /// <summary>
        /// 分页展示商品列表页
        /// </summary>
        /// <param name="pageIndex">当前页码</param>
        /// <param name="pageSize">每页显示的记录</param>
        /// <param name="pname">商品名称</param>
        /// <returns></returns>
        public ProductPage ShowProductPage(int pageIndex, int pageSize, string pname)
        {
            return dal.ShowProductPage(pageIndex, pageSize, pname);
        }
    }
}
